package com.cy.dbsys.dao;

import com.cy.dbsys.pojo.SysUser;
import com.cy.dbsys.pojo.SysUserDept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SysUserDao {
    /**基于id修改账户密码*/
    @Update("update sys_users set password=#{newPassword},salt=#{newSalt} where id=#{id}")
    int updatePassword(String newPassword,String newSalt,Integer id);
    /**(授权模块)*/
    SysUser findUserByUserName(String username);
    /**(修改模块)2、根据id修改用户信息*/
    int updateObject(SysUser entity);

    /**(修改模块)1、根据id查询用户相关信息*/
    SysUserDept findObjectById(Integer id);

    /**(添加模块)*/
    int insertObject(SysUser entity);
    /**(查询模块)基于用户名进行分页查询(底层基于PageHelper去实现)*/
    List<SysUserDept> findPageObjects(String username);
    /**禁用启用*/
    int validById(
                @Param("id")Integer id,
                @Param("valid")Integer valid,
                @Param("modifiedUser")String modifiedUser);

}

